<%--
  Created by IntelliJ IDEA.
  User: yutong
  Date: 14-4-24
  Time: 上午11:10
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
        <%@include file="../includes/common.jsp" %>
        <%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
        <%@ page contentType="text/html;charset=UTF-8" %>

        <link rel="stylesheet" type="text/css"  href="<c:url value='/js/css/spigPet.css'/>"/>
        <title>用户注册</title>
    </head>
<body>
    <div>
            <form id="fileGetUp" method="post" enctype="multipart/form-data" class="form-horizontal">
                <fieldset id="course">
                    <legend style="font-size: 20px;margin-left: 70px;">课件信息</legend>
                    <div class="control-group">
                        <label class="control-label" for="upfile">选择文件：</label>
                        <div class="controls">
                            <input type="file" name="upFile" id="upFile"/>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="scormName">课件名称：</label>
                        <div class="controls">
                            <input type="text" id="scormName" name="scormName" >
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="courseType">课件类别：</label>
                        <div class="controls">
                            <input type="text" id="showCourseType" name="showCourseType" flag="course_type" autocomplete="off">
                            <input type="hidden" id="courseType" name="courseType" autoHidden="autoHidden">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="courseDisc">课件描述：</label>
                        <div class="controls">
                            <textarea  id="courseDisc" name="courseDisc" ></textarea>
                        </div>
                    </div>
                </fieldset>
            </form>

    </div>

    <div class="controls" style="text-align: center">
        <input type="button" id="saves" class="btn btn-primary" onclick="fileUpAttachment()"
               value="确认上传"/>
        <input type="button" onclick="quit()" class="btn btn-primary"
               value="返回"/>
    </div>
</body>
</html>
<script type="text/javascript" src="<c:url value="/js/jquery.cityselect.js" />"></script>
<script type="text/javascript">

    function fileUpAttachment() {
        var upFile = document.getElementById("upFile").value;
        var fileType=upFile.indexOf(".zip",upFile.length-4);
        var scormName=$("#scormName").val().trim();
        var courseType=$("#courseType").val().trim();
        var courseDisc=$("#courseDisc").val().trim();

        if(fileType==-1){
            alert("上传格式不是zip");
        }else{
            var zipInfo=encodeURI(encodeURI(scormName))+","+courseType+","+encodeURI(encodeURI(courseDisc))+","+showLocale(new Date());
            $("#fileGetUp").attr("action", basePath + "scormZip/upFile?upFile=" + upFile+"&zipInfo="+zipInfo);
            $("#fileGetUp").submit();

        }

    }
    function getCity(){
        $("#city").attr("value", $("#prov").val()+","+ $("#citys").val());
    }

    function quit() {
        parent.$("#dataEdit").dialog('close');
    }

</script>